package chapter_23.manager;

import chapter_23.runnable.Runner;

/**
 * 线程优先级测试(优先级)
 */
public class ThreadPriority {

    public static void main(String[] args) {
        // 创建线程t1,参数是一个线程执行对象Runner
        Thread t1 = new Thread(new Runner());
        // 设置最高优先级
        t1.setPriority(Thread.MAX_PRIORITY);

        // 开始线程t1
        t1.start();

        // 创建线程t2,参数是一个线程执行对象Runner
        Thread t2 = new Thread(new Runner(),"MyThread");
        // 设置最低优先级
        t1.setPriority(Thread.MIN_PRIORITY);

        // 开始线程t2
        t2.start();

    }

}
